let express = require('express')
let router = express.Router()

// 登录接口
let { login } = require('./api/login')
router.post('/user/login', login)
// 角色接口
let { getRole, addRole, updateRole, deleteRole, getRoleName } = require('./api/role')
router.get('/user/getRole', getRole)
router.post('/user/addRole', addRole)
router.post('/user/updateRole', updateRole)
router.post('/user/deleteRole', deleteRole)
router.get('/user/getRoleName', getRoleName)
// 上传图片
let { upload } = require('./api/upload')
router.post('/user/upload', upload)
// 配置图片上虚拟路由
router.use("/upload", express.static("upload"))
// 用户接口
let { getUser, updateUser, addUser, filterUserData, setUserPwd } = require('./api/user')
router.get('/user/getUser', getUser)
router.post('/user/updateUser', updateUser)
router.post('/user/addUser', addUser)
router.post('/user/filterUserData', filterUserData)
router.post('/user/setUserPwd', setUserPwd)
// 向外暴露router
module.exports = router